<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数值类型</title>
</head>
<body>
<h1>数值类型</h1>
<script type="text/javascript">
  //字面量/直接量用法
  var number1 = 0.1;
  var number2 = 0.2;
  var number3 = number1 + number2;
  console.log(number3);
  //= 赋值, == 比较, === 比较
  console.log(number1); //输出0.30000000000000004
  console.log(number3 == 0.3);

  //尽量避免小数运算
  var number = (0.1*10 + 0.2*10) / 10;
  console.log(number);

  //数值范围
  console.log("number最大值：" + Number.MAX_VALUE);  //最大值
  console.log("number最小值：" + Number.MIN_VALUE);  //最小值
  console.log("无穷大：" + Infinity); //无穷大
  console.log("无穷小：" + -Infinity);  //无穷小
</script>

</body>
</html>